<template>
  <view @click="goDetail">
    <wd-card>
      <!-- 状态标题栏 -->
      <view class="flex items-center px-4 pt-3">
        <TagIcon :type="ticketData.workType" :value="ticketData.workStatus"></TagIcon>
      </view>

      <!-- 详细信息区域 -->
      <view class="p-2 space-y-1">
        <!-- 客户信息 -->
        <view class="flex">
          <text class="text-gray-500 w-20 flex-shrink-0">工单编号：</text>
          <text class="text-gray-800 flex-1">{{ ticketData.workSN }}</text>
        </view>

        <!-- 计划时间 -->
        <view class="flex">
          <text class="text-gray-500 w-20 flex-shrink-0">客户：</text>
          <text class="text-gray-800 flex-1">{{ ticketData.client }}</text>
        </view>

        <!-- 地址 -->
        <view class="flex">
          <text class="text-gray-500 w-20 flex-shrink-0">地址：</text>
          <text class="text-gray-800 flex-1">{{ ticketData.address }}</text>
        </view>

        <!-- 维修单号 -->
        <view class="flex">
          <text class="text-gray-500 w-20 flex-shrink-0">联系电话：</text>
          <text class="text-gray-800 flex-1">{{ ticketData.phone }}</text>
        </view>
        <view class="flex">
          <text class="text-gray-500 w-20 flex-shrink-0">施工人员：</text>
          <text class="text-gray-800 flex-1">{{ ticketData.workUser.join(',') }}</text>
        </view>
      </view>
    </wd-card>
  </view>
</template>

<script lang="ts" setup>
import { ref, computed, PropType } from 'vue'
import TagIcon from './TagIcon.vue'
interface TicketData {
  id: number
  workSN: string
  workType: number
  workStatus: number
  workName: string
  workTime: string
  workUser: string[]
  address: string
  isStart: boolean
  client: string
  phone: string
}
const props = defineProps({
  ticketData: {
    type: Object as PropType<TicketData>,
    default: () => ({}) as TicketData,
    required: true
  }
})

const goDetail = () => {
  console.log(1111)
  if (props.ticketData.workType) {
    uni.navigateTo({
      url: '/pages/ticket/detail1?id=' + props.ticketData.id
    })
    return
  }
  uni.navigateTo({
    url: '/pages/ticket/detail?id=' + props.ticketData.id
  })
}
</script>

<style lang="scss"></style>
